package com.caidan.security.controller;

import com.caidan.security.domain.ResponseResult;
import com.caidan.security.domain.User;
import com.caidan.security.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    public ResponseResult login(@RequestBody User user) {
        ResponseResult responseResult = loginService.login(user);
        return responseResult;
    }
}
